# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python
from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction  # 操作模块：滑动、tap点击（模拟手势单点）
from appium.webdriver.common.mobileby import MobileBy # 元素定位：ID、NAME、XPATH、CLASS NAME ...

caps = {}
caps["platformName"] = "Android"            # 平台名称
caps["platformVersion"] = "7.1.2"           # 版本号
caps["deviceName"] = "x1q"                  # 设备名称
caps["appPackage"] = "com.lingyue.zebraloan"            #APP包名：可以通过 adb shell pm list packages -3 或者是将当前应用运行，使用：adb shell dumpsys activity activities
caps["appActivity"] = "com.lingyue.banana.activities.BananaLaunchActivity"          # Activity事件：将当前应用运行，使用：adb shell dumpsys activity activities获取

driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) # localhost == 127.0.0.1 都是本机的意思

el2 = driver.find_element(MobileBy.XPATH,"//android.widget.LinearLayout[@content-desc=\"我的\"]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ImageView")
el2.click()
TouchAction(driver).tap(x=145, y=664).perform()
el3 = driver.find_element(MobileBy.ID,"com.lingyue.zebraloan:id/btn_navigation")
el3.click()
